package com.unchartedskies.controller.command
{
	import com.gamesmile.framework.util.Log;
	import com.unchartedskies.controller.event.AccueilClickEvent;
	import com.unchartedskies.model.State;
	import com.unchartedskies.model.value.StateConstant;
	import com.unchartedskies.view.Accueil;
	
	import flash.net.URLRequest;
	import flash.net.navigateToURL;
	
	import org.robotlegs.mvcs.Command;
	
	public class AccueilCommand extends Command
	{
		[Inject]
		public var accueilClickEvent:AccueilClickEvent;
		
		[Inject]
		public var state:State;
		
		override public function execute():void
		{
			Log.debug(this,"Execute AccueilClickCommand");
			Log.debug(this,"Target name  "+accueilClickEvent.targetName);
			
			switch(accueilClickEvent.targetName)
			{
				case Accueil.BT_PLAY:
				{
					state.currentState = StateConstant.STATE_LOGIN;
				break;
				}
					
				case Accueil.BT_CREDITS:
				{
					state.currentState = StateConstant.STATE_CREDITS;
					break;
				}
					
				case Accueil.BT_FORUM:
				{
					navigateToURL(new URLRequest("http://www.unchartedskies.com/forum"));
					break;
				}
					
				case Accueil.BT_MOREGAMES:
				{
					navigateToURL(new URLRequest("http://www.mochigames.com/?utm_source=sponsored_game&utm_medium=more_games&utm_content=flying-fury&utm_campaign=sponsored_game"));
					
					break;
				}
					
				case Accueil.BT_TUTORIAL:
				{
					
					break;
				}
				case Accueil.BT_WALKTHROUGH:
				{
					navigateToURL(new URLRequest("http://www.mochigames.com/games/flyingfury_v345656/?utm_source=sponsored_game&utm_medium=walkthrough&utm_content=flying-fury&utm_campaign=sponsored_game"));
					
					break;
				}
				
					
				default:
				{
				break;
				}
			}
		}
	}
}